package com.neu.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.neu.po.ResponseResult;
import com.neu.po.Vipmanage;
import com.neu.service.VipManageService;
@RestController
@RequestMapping("VIPManage")
public class VIPManageController {
	@Autowired
	private VipManageService vipManageService;
	
	 @RequestMapping("update")
		public ResponseResult update(@RequestBody Vipmanage vipmanage) {
			ResponseResult result = new ResponseResult();
			result.setData(vipManageService.update(vipmanage));
			
			return result;
		}
		
		@RequestMapping("delete")
		public ResponseResult delete(int id) {
			ResponseResult result = new ResponseResult();
			result.setData(vipManageService.delete(id));
			
			return result;
		}
		
		@RequestMapping("insert")
		public ResponseResult insert(@RequestBody Vipmanage vipmanage) {
			ResponseResult result = new ResponseResult();
			vipmanage.setDelmark(1);
			result.setData(vipManageService.insert(vipmanage));
			
			return result;
		}
		
		@RequestMapping("getAllVIP")
		public ResponseResult getAllVIP() {
			ResponseResult result = new ResponseResult();
			result.setData(vipManageService.getAllVIP());
			
			return result;
		}
		
		@RequestMapping("getPaged")
		public ResponseResult getPaged(int pageNum,int pageSize,String keyword) {
			ResponseResult result = new ResponseResult();
			result.setData(vipManageService.getPaged(pageNum, pageSize,keyword));
			
			return result;
		}
	   
		@RequestMapping("batchDeleteVIP")
		public ResponseResult batchDeleteVIP(@RequestBody List<Integer> ids) {
			ResponseResult result = new ResponseResult();
			result.setData(vipManageService.batchDeleteVIP(ids));
			
			return result;
		}
		@RequestMapping("getVIPById")
		   public ResponseResult getVIPById(int id) {
			   ResponseResult result = new ResponseResult();
			   List<Vipmanage> list = vipManageService.getVIPById(id);
			   
			   result.setData(list);
			   return result;
		   }
}
